# 依赖项检查脚本
import sys

# 检查必要的依赖项
required_packages = [
    'cv2',          # OpenCV
    'face_recognition',  # face_recognition
    'dlib',         # dlib
    'numpy',        # NumPy
    'PIL',          # Pillow
    'matplotlib'    # Matplotlib
]

print("=== 依赖项检查结果 ===")
missing_packages = []

for pkg in required_packages:
    try:
        __import__(pkg)
        print(f"✅ {pkg} 已安装")
    except ImportError:
        print(f"❌ {pkg} 未安装")
        missing_packages.append(pkg)

if missing_packages:
    print("\n=== 安装指南 ===")
    for pkg in missing_packages:
        if pkg == 'cv2':
            print(f"🔧 {pkg}: 运行 install_opencv.bat 脚本")
        elif pkg == 'dlib':
            print(f"🔧 {pkg}: 参考 INSTALL_FACE_RECOGNITION.md 手动安装")
        elif pkg == 'face_recognition':
            print(f"🔧 {pkg}: 先安装 dlib，然后运行 pip install face_recognition -i https://pypi.tuna.tsinghua.edu.cn/simple")
        else:
            print(f"🔧 {pkg}: 运行 pip install {pkg} -i https://pypi.tuna.tsinghua.edu.cn/simple")
else:
    print("\n✅ 所有依赖项均已安装！")
    print("您可以运行 face_recognition_app.py 了。")